var mongoose = require('mongoose');
var config = require('../config/config');
mongoose.connect(config.mongodbUrl, { useMongoClient: true });
mongoose.Promise = global.Promise;

mongoose.connection.on('connected', function() {
    console.log('Mongoose connected to ' + config.mongodbUrl);
});
mongoose.connection.on('error', function(err) {
    console.log('Mongoose connection error: ' + err);
});
mongoose.connection.on('disconnected', function() {
    console.log('Mongoose disconnected');
});